<?php
    /**
     * difF PHP Framework :: mysql.php
     *
     * @version: 2.7
     * @date   : 6/10/2012
     * @author Melisides Constantinos (dsphinx@gmail.com)
     * @require mysqli.php
     * @Description:  mysql
     *
     *  TODO:
     *
     * Licensed under MIT licence:
     *   http://www.opensource.org/licenses/mit-license.php
     **/


    require_once('Mysqli.php');


    class MyDB extends Dbi
    {
        static $__db;

        static function init_db()
        {
            if (!self::$__db) {
                self::$__db = new self();
            }

            return self::$__db ;
        }

        static function db()
        {

            return (self::$__db ? self::$__db : FALSE);
        }


        function description($table )
        {

            $tmp = $this->sql(" describe  " . $table);

            return $tmp;
        }


        function show_tables()
        {

            $tmp = $this->sql(" show tables ");

            return $tmp;
        }


        public function stats()
        {

            $db       = new self();
            $status   = explode('  ', mysqli_stat($db->_mysqli));
            $status[] = "Server : " . mysqli_get_server_info($db->_mysqli);
            $db->close();

            return $status;
        }


    }